package com.tamecode.chapter06.sec3;

import org.apache.commons.dbcp.BasicDataSource;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class AppTest {
    public static void main(String[] args) {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("sec6-3/bean-propertyPlaceholder.xml");
        MyDataSource bean = applicationContext.getBean(MyDataSource.class);
        System.out.println(bean); // MyDataSource(driverClassName=com.mysql.jdbc.Driver, url=jdbc:mysql://localhost:3306/sampledb, username=root, password=root)
        System.out.println(applicationContext.getBean(BasicDataSource.class).getUrl()); // jdbc:mysql://localhost:3306/sampledb
    }
}
